package com.service;

import com.entity.FinanceLoanInfo;
import com.repository.FinanceLoanInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class FinanceLoanInfoService {

    @Autowired
    private FinanceLoanInfoRepository loanInfoRepository;

    public List<FinanceLoanInfo> findAll() {
        return loanInfoRepository.findAll();
    }

    public Page<FinanceLoanInfo> findAll(Pageable pageable) {
        return loanInfoRepository.findAll(pageable);
    }

    public Optional<FinanceLoanInfo> findById(Integer id) {
        return loanInfoRepository.findById(id);
    }

    public FinanceLoanInfo save(FinanceLoanInfo loanInfo) {
        return loanInfoRepository.save(loanInfo);
    }

    public void deleteById(Integer id) {
        loanInfoRepository.deleteById(id);
    }
}